package club.justwill.single.assembler;

import club.justwill.single.bean.Activity.ActivityResp;
import club.justwill.single.persistence.jpo.Activity;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * Created by xiangnan on 16-1-18.
 */

@Component
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public class ActivityAssemble {

    public ActivityResp assemble(Activity activity) {
        return new ActivityResp(activity);
    }

    public List<ActivityResp> assembleActivityList(List<Activity> activities) {
        List<ActivityResp> activityRespList = new ArrayList<ActivityResp>();
        if (activities != null) {
            for(Activity activity : activities) {
                activityRespList.add(assemble(activity));
            }
        }
        return activityRespList;
    }
}
